package com.xiaoxi.prototypemode.manager;

import com.xiaoxi.prototypemode.product.IProduct;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName ProductManager
 * @Description
 * @Author xiaoxi
 * @Date 2023/3/12 15:08
 * @Version 1.0
 */
public class ProductManager {

    private Map<String, IProduct> productMap = new HashMap<>();

    public void register(String productName, IProduct product) {
        productMap.put(productName, product);
    }

    public IProduct cloneProduct(String productName) {
        return productMap.get(productName).createClone();
    }

}
